Localization How's it done in the backoffice?
# help-with-umbraco
a
Following this documentation: https://apidocs.umbraco.com/v9/ui/#/api/umbraco.directives.directive:localize I can't figure out how to use it with <umb-box-header for example. I have tried:
<umb-box-header localize="title" title="@umbcheckout_license_addon">
and in the en-us.xml file:
Copy code
<area alias="umbcheckout">
        <key alias="license_addon">License Addon</key>
    </area>
However it is not working and I get the attached image, what am I missing here?
s
Did you restart the site after adding the translation? If so, I'm guessing the second underscore might be seen as a separator, try not using more than 1 underscore 🙂
a
Found it:
<umb-box-header title-key="umbcheckout_license_addon">
I really hope the new backoffice has better documentation 😅
s
fair enough
it will 😛
a
@AaronSadlerUK What I can recommend is checking the directive files in the core
The comments also show an example for the properties you can pass in to the
a
Yeah that's what I normally do, I usually have the core open for GitHub search 😅
a
Copy code
@param {string=} title (<code>attrbute</code>): Custom title text.
@param {string=} titleKey (<code>attrbute</code>): The translation key from the language xml files.
@param {string=} description (<code>attrbute</code>): Custom description text.
@param {string=} descriptionKey (<code>attrbute</code>): The translation key from the language xml files.
a
On anothernote in the c# side, is this correct?
_localizedTextService.Localize("umbcheckout", "success_page_url_label", CultureInfo.CurrentUICulture),
a
Sorry got distracted 😄
@AaronSadlerUK I only ever used this one :
localizationService.localize("memberGroup_removeTitle")
Woops c# side
then yes
Should work
a
ok so final question 😅 What would be the recommended way to localize this:
Documentation available at <a href="https://docs.umbcheckout.net/" target="_blank">https://docs.umbcheckout.net/</a>. Please report any issues in the bug tracker found on the <a target="_blank" href="https://github.com/UmbHost/UmbCheckout/issues">GitHub Repo here</a>.
With the link?
a
Pfoa
I guess i'd put it in a single translation to be honest..
a
How would the link be handled though, as surely you wouldn't put HTML in the translation?
a
Well tbh, the links dont need to be translated at all ?
You could also do the
document available at
and the
. Please report any issues in the bug tracker found on the
in a translation
a
Nope, but as it's mid sentence, I'm struggling to see how to localize it without splitting the sentence up
a
ah
Well I usually look at Umbraco source in such a case:
Copy code
<key alias="domainHelpWithVariants">
      <![CDATA[Valid domain names are: "example.com", "www.example.com", "example.com:8080", or "https://www.example.com/".
     Furthermore also one-level paths in domains are supported, eg. "example.com/en" or "/en".]]></key>
Not the nicest though, but its either this, or split up the string in two parts
a
That could work 🤔 Thanks!
a
Anytime!
5 Views